/**
 * Copyright (c) 2011 Tomi Paananen.
 *
 * Part of Quick Gestures engine library.
 */

#ifndef __GESTURE_H__
#define __GESTURE_H__

// Qt includes
#include <QList>
#include <QMetaType>
#include <QObject>
#include <QPoint>
#include <QSize>
#include <QString>

// qgengine includes
#include "qgcommon.h"
#include "qgenginepriv.h"


class QGLIB_EXPORT Gesture : public QObject
{
    Q_OBJECT
    Q_PROPERTY(quint32 gestureId READ id WRITE setId NOTIFY idChanged)
    Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
    Q_PROPERTY(quint32 attributes READ attributes WRITE setAttributes NOTIFY attributesChanged)
    Q_PROPERTY(int pointCount READ pointCount NOTIFY pointCountChanged)
    Q_ENUMS(GestureAttributes)

public: // Data types

    enum GestureAttributes {
        None = 0x0,
        FixedDirection = 0x2,
        FixedStartingPoint = 0x4
    };

public: // Construction and destruction
    explicit Gesture(QObject *parent = 0);
    explicit Gesture(const Gesture &gesture, QObject *parent = 0);
    virtual ~Gesture();

public: // Operators
    Gesture &operator=(const Gesture &gesture);
    bool operator==(const Gesture &gesture);
    bool operator!=(const Gesture &gesture);

public:
    void setId(quint32 id);
    quint32 id() const;
    const QString &name() const;
    quint32 attributes() const;
    int pointCount() const;
    const PointList &points() const;
    PointList &modifiablePoints();

public slots:
    void setName(const QString &name);
    void setAttributes(quint32 attributes);
    void setPoints(PointList &points);
    void appendPoint(QPoint point);
    void appendPoint(int x, int y);
    void clear();

signals:
    void idChanged(quint32 id);
    void nameChanged(const QString &name);
    void attributesChanged(quint32 attributes);
    void pointCountChanged(int count);

private: // Data
    quint32 m_id;
    QString m_name;
    quint32 m_attributes;
    PointList m_points;
};

Q_DECLARE_METATYPE(Gesture)


#endif /* __GESTURE_H__ */

// End of file.

